package com.wjh.anyview.websocket.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * redis消息队列的发布者配置类
 *
 * @author wjh
 * @date 2021/10/11 21:01
 * @Package com.example.demo.config
 */
@Configuration
public class PublisherConfig {
    /**
     * 注册redisTemplate，作为消息队列的发布者
     *
     * @param redisConnectionFactory RedisConnectionFactory对象
     * @return new StringRedisTemplate(redisConnectionFactory);
     */
    @Bean("getRedisTemplate")
    public StringRedisTemplate getRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
        return new StringRedisTemplate(redisConnectionFactory);
    }

}
